home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / admin / xinetd.2 / xinetd / xinetd.2.1.7-linux.4 / libs / src / str / strparse.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-25  |  1.5 KB  |  55 lines

  1. /*
  2.  * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  3.  * All rights reserved.  The file named COPYRIGHT specifies the terms 
  4.  * and conditions for redistribution.
  5.  */
  6.  
  7.  
  8. /*
  9.  * $Id: strparse.h,v 3.1 1993/06/13 02:48:35 panos Exp $
  10.  */
  11.  
  12. struct str_handle
  13. {
  14.    char *string ;
  15.    char *separator ;
  16.    char *pos ;
  17.    int flags ;
  18.    int *errnop ;
  19.    int no_more ;
  20. } ;
  21.  
  22. int str_errno ;
  23.  
  24. #ifndef NULL
  25. #define NULL         0
  26. #endif
  27.  
  28. #ifndef FALSE
  29. #define FALSE        0
  30. #define TRUE         1
  31. #endif
  32.  
  33. #define PRIVATE        static
  34.  
  35. #define TERMINATE( msg )   {                                         \
  36.                               char *s = msg ;                        \
  37.                                                                      \
  38.                               (void) write( 2, s, strlen( s ) ) ;    \
  39.                               (void) abort() ;                       \
  40.                               _exit( 1 ) ;                           \
  41.                               /* NOTREACHED */                       \
  42.                            }
  43.  
  44.  
  45. #define HANDLE_ERROR( flags, retval, errp, errval, msg )    \
  46.             if ( flags & STR_RETURN_ERROR )                 \
  47.             {                                               \
  48.                *errp = errval ;                             \
  49.                return( retval ) ;                           \
  50.             }                                               \
  51.             else                                            \
  52.                TERMINATE( msg )
  53.  
  54.  
  55.